package o;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

class fwu<T> {
    private final String ˊ;
    private final Class<?> ˋ;
    private final Class[] ॱ;

    fwu(Class<?> cls, String str, Class... clsArr) {
        this.ˋ = cls;
        this.ˊ = str;
        this.ॱ = clsArr;
    }

    public boolean ˏ(T t) {
        return ॱ(t.getClass()) != null;
    }

    public Object ˊ(T t, Object... objArr) throws InvocationTargetException {
        Object obj = null;
        Method ॱ = ॱ(t.getClass());
        if (ॱ != null) {
            try {
                obj = ॱ.invoke(t, objArr);
            } catch (IllegalAccessException e) {
            }
        }
        return obj;
    }

    public Object ˏ(T t, Object... objArr) {
        try {
            return ˊ(t, objArr);
        } catch (InvocationTargetException e) {
            Throwable targetException = e.getTargetException();
            if (targetException instanceof RuntimeException) {
                throw ((RuntimeException) targetException);
            }
            AssertionError assertionError = new AssertionError("Unexpected exception");
            assertionError.initCause(targetException);
            throw assertionError;
        }
    }

    public Object ˎ(T t, Object... objArr) throws InvocationTargetException {
        Object ॱ = ॱ(t.getClass());
        if (ॱ == null) {
            throw new AssertionError("Method " + this.ˊ + " not supported for object " + t);
        }
        try {
            return ॱ.invoke(t, objArr);
        } catch (Throwable e) {
            AssertionError assertionError = new AssertionError("Unexpectedly could not call: " + ॱ);
            assertionError.initCause(e);
            throw assertionError;
        }
    }

    public Object ॱ(T t, Object... objArr) {
        try {
            return ˎ(t, objArr);
        } catch (InvocationTargetException e) {
            Throwable targetException = e.getTargetException();
            if (targetException instanceof RuntimeException) {
                throw ((RuntimeException) targetException);
            }
            AssertionError assertionError = new AssertionError("Unexpected exception");
            assertionError.initCause(targetException);
            throw assertionError;
        }
    }

    private Method ॱ(Class<?> cls) {
        if (this.ˊ == null) {
            return null;
        }
        Method ˎ = ˎ(cls, this.ˊ, this.ॱ);
        if (ˎ == null || this.ˋ == null || this.ˋ.isAssignableFrom(ˎ.getReturnType())) {
            return ˎ;
        }
        return null;
    }

    private static Method ˎ(Class<?> cls, String str, Class[] clsArr) {
        try {
            Method method = cls.getMethod(str, clsArr);
            try {
                if ((method.getModifiers() & 1) == 0) {
                    return null;
                }
                return method;
            } catch (NoSuchMethodException e) {
                return method;
            }
        } catch (NoSuchMethodException e2) {
            return null;
        }
    }
}
